#ifndef __RSA_H__
# define __RSA_H__

# include <sys/types.h>

typedef u_int64_t t_uint64;
typedef int64_t   t_int64;
typedef t_uint64* t_cryptedMessage;
typedef t_uint64  t_cryptedChar;

typedef struct  s_publicKey
{
    t_uint64    e;
    t_uint64    n;
}               t_publicKey;

typedef struct  s_privateKey
{
    t_uint64    d;
    t_uint64    n;

    t_uint64    p;
    t_uint64    q;
    t_uint64    phi_n;
}               t_privateKey;

int             generate_primes(t_privateKey *priv);
t_uint64        multiplicative_mod_inverse(t_uint64 a, t_uint64 b);
int             generate_keys(t_publicKey *pub, t_privateKey *priv,
                              t_uint64 p, t_uint64 q);
t_uint64        gcd(t_uint64 a, t_uint64 b);

#endif /* !__RSA_H__ */
